#include <string.h>
#include <string>
#include "InputUtils.h"

const char* modifyFileName(const char* fileName)
{
    return hasZipExtention(fileName) ? fileName : concatZipExtention(fileName);
}

bool hasZipExtention(const char* fileName)
{
    int size = strlen(fileName);
    return fileName[size - 1] == 'p' && fileName[size - 2] == 'i' && fileName[size - 3] == 'z' && fileName[size - 4] == '.';
}

char* concatZipExtention(const char* fileName)
{
    std::string file = fileName;
    file += ZIP_EXTENTION;
    char* zipFileName = new char[file.size() + 1];
    strcpy(zipFileName, file.c_str());
    zipFileName[file.size()] = '\0';
    
    return zipFileName;
}